<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/common/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>区域维护</title>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/aa.js"></script>
<link rel="stylesheet" href="front/css/common.css" type="text/css" />


</head>
<body>
<html:form action="maintainVehicleAction" method="post">
<input type="hidden" name="callMethod" id="callMethod" value="getAreaDataList"/>

<table width="99%" border="0" align="center" cellpadding="3"		cellspacing="1" class="table_style">
		<tr>
			<td width="45%" class="left_title_3">区域名称： <input type="hidden"  name="areaID"  id="areaID"/> <input type="text"  name="area" maxlength="10" id="area"/> 客户审查费：<input type="text" maxlength="6"  name="khscf"  id="khscf"/></td>
		<td colspan="3" ><input type="button" id="updateButton" onclick="submitArea()" value="增加区域"></td>
		</tr>
</table>

<aa:zone name="areaZone">
	<div id="man_zone">

				<table width="99%" border="0" align="center" cellpadding="3"
					cellspacing="1" class="table_style">
		<tr>
			<td width="10%" class="left_title_3">序号</td>
			<td width="20%" class="left_title_3">区域名称</td>
			<td width="20%" class="left_title_3">客户审查费</td>
			<td  class="left_title_3">操作&nbsp;&nbsp;(已经在单据使用的地区不允许删除)</td>
			
		</tr>
			<nested:iterate id="areaVO" property="areaList" indexId="areaIndex">
				<tr>
					<td><%=areaIndex+1%></td>
					<td><nested:write  property="area" /></td>
					<td><nested:write  property="khscf" /></td>
					<td><input type="button" onclick="updateArea('<nested:write name="areaVO" property="areaID" />','<nested:write name="areaVO" property="area" />','<nested:write name="areaVO" property="khscf" />')" value="编辑">&nbsp;&nbsp;
					<nested:equal property="acount" value="0"> 
						<input type="button" onclick="deleteArea('<nested:write name="areaVO" property="areaID" />')" value="删除">
					</nested:equal>
					
					<nested:notEqual property="acount" value="0"> 
						<input type="button"  disabled="disabled" value="删除">
					</nested:notEqual>
					
					</td>
				</tr>
			</nested:iterate>
		
		</table>
		</div>
		</aa:zone>
</html:form>


<script type="text/javascript">
function deleteArea(index){
	if(!confirm("确定要删除此条记录?")){
		return;
	}
	
	$('#areaID').val(index);
	ajaxAnywhere.submitAJAX("deleteArea", "areaZone");
	$('#areaID').val("");
}

function submitArea(){
	if($.trim($('#area').val())==""){
		alert("必须输入区域名称");
		return;
	}
	
	else if(isNaN($.trim($('#khscf').val()))) {
		alert('客户审查费必须为数字！');
		$(this).val(1);							
	}
	
	else{
		ajaxAnywhere.submitAJAX("updateArea", "areaZone");
		$('#areaID').val("");
		$('#area').val("");
		$('#khscf').val("");
		$('#updateButton').val("增加区域");
		
	}
	
	
	
	
	
}

function updateArea(x1,x2,x3){
	$('#updateButton').val("更新区域");
	
	$('#areaID').val(x1);
	$('#area').val(x2);
	$('#khscf').val(x3);
	
	
}

AjaxAnywhere.prototype.onAfterResponseProcessing = function () {
	alert("地区维护成功!");
};

ajaxAnywhere.showLoadingMessage = function() {
}
</script>


</body>
</html>